<?php
if($searchResults['total'] > $limit)
{
	$pages = array();
	for($k=1,$j = 0; $j < $searchResults['total']; $k++,$j = $j + $limit)
	{
		
		if($j > ($offset + $limit * 10) or $j < ($offset - $limit * 10))
		{
			continue;
		}
		$class = ($j == $offset) ? ' class="highlight"' : '';
		$pages[] = '<a href="' . mcz_BASE_URL . 'index.php?c=search&amp;searchTerms='
						. urlencode($searchTerms)
						. ($metaphone ? '&amp;metaphone=on' : '')
						. '&amp;offset=' . $j . '"'.$class.'>'
						. $k
				. '</a>';

		/*
		if($j == $offset)
		{
			$currentPage = $k;
			$pages[] = '<input type="text" value="' . $currentPage . '"/>';
		}
		*/
	}
	$pager = implode(' - ', $pages);
	$pager = '<div style="text-align:center;"><a href="' . mcz_BASE_URL . 'index.php?c=search&amp;searchTerms='
						. urlencode($searchTerms)
						. ($metaphone ? '&amp;metaphone=on' : '')
						. '&amp;offset=0">&lt;&lt;</a> - '
						. $pager
						. ' - <a href="' . mcz_BASE_URL . 'index.php?c=search&amp;searchTerms='
						. urlencode($searchTerms)
						. ($metaphone ? '&amp;metaphone=on' : '')
						. '&amp;offset=' . ($j - $limit) . '">&gt;&gt;</a>' . '</div>';
}
else
{
	$pager = '';
}